package com.spring.springmvc.请求.json和java转换;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.spring.springmvc.请求.传参.People;

public class java转json {
    public static void main(String[] args) throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        People people = new People("张三",13,"男");
        String json = objectMapper.writeValueAsString(people);
        System.out.println(json);
    }
}
